import 'package:flutter/material.dart';
import 'package:sensors_analytics_flutter_plugin/sensors_analytics_flutter_plugin.dart';

class BuryUp extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return BuryState();
  }
}

class BuryState extends State<BuryUp> {
  Widget build(BuildContext context) {
    SensorsAnalyticsFlutterPlugin.enableLog(true);

    return Center(
      child: Flex(
        direction: Axis.vertical,
        children: [
          RaisedButton(
            child: Text('点击上报'),
            onPressed: () async {
              print('上报');
              SensorsAnalyticsFlutterPlugin.track("Flutter_AddToFav", {
                "ProductID": 123456,
                "UserLevel": "VIP",
                "UserType": "onPressed",
              });
              // SensorsAnalyticsFlutterPlugin.trackInstallation(
              //     'AppInstall', {'key1': 'value1', 'key2': 'value2'});
            },
          ),
        ],
      ),
    );
  }
}
